<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    console.log("1. 同步任务");
setTimeout(() => {
  console.log("4. 宏任务（setTimeout）");
  Promise.resolve().then(() => console.log("5. 微任务（嵌套在宏任务中）"));}, 0);

Promise.resolve().then(() => {
  console.log("3. 微任务（Promise）");});

console.log("2. 同步任务");

1同步任务--->2同步任务---->3微任务---->4宏任务---->5微任务





</body>
</html>